<template>
  <div>
    <el-row>
      <el-col :span="24">
        <div style="height: 20px;"></div>
        <el-input v-model="leagueNameChos" @change="this.loadCoachLeagueClass()" placeholder="请输入团课名称或关键字" style="width: 200px; text-align: left;"></el-input>
        <el-table :data="page"  border>
          <el-table-column prop="leagueClass.leagueClassName" label="团课名" width="100"></el-table-column>
          <el-table-column prop="venueBase.venueName" label="场馆名" width="100"></el-table-column>
          <el-table-column prop="venueClassroom.classroomId" label="教室号" width="100"></el-table-column>
          <el-table-column prop="leagueClass.leagueClassDetail" label="课程描述" width="344"></el-table-column>
          <el-table-column prop="startTime" label="开始时间" width="100"></el-table-column>
          <el-table-column prop="endTime" label="结束时间" width="100"></el-table-column>
          <el-table-column prop="leagueClass.minute" label="分钟数" width="100"></el-table-column>
          <el-table-column prop="remark" label="备注" width="300"></el-table-column>
          <el-table-column label="操作" width="50">
            <template #default="scope">

              <el-button @click="pass(scope.row.id)"  type="text"
                size="small">完成</el-button>
              <el-button @click="reject(scope.row.id)"  type="text"
                size="small">取消</el-button>

            </template>
          </el-table-column>
        </el-table>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'CoachLeagueClassDeal',
  data() {
    return {
      page:{},
      leagueNameChos:'',

      }
  },
  methods: {
    reject(id){
      this.$http.get('product/yLeagueWorkforce/cancelLeagueClassForce',{
        params:
        {
          id:id,
          }
      })
      .then(resp => {
        this.loadCoachLeagueClass()
      })
    },
    pass(id){
      this.$http.post('product/yLeagueWorkforce/finishLeagueClassForce',{
          id:id
      })
      .then(resp => {
        this.loadCoachLeagueClass()
      })
    },
    loadCoachLeagueClass() {
      /**
       * 调用方法 查询我的团课
       */
      this.$http.get('product/yLeagueWorkforce/loadLeagueWorkforceByCoach',{
        params:{
          className:this.leagueNameChos
        }
      })
      .then(resp => {
        this.page=resp.data.data;
      })
    }
  },
  created() {
    this.loadCoachLeagueClass();
  }
};
</script>

<style>
.el-table .el-table__cell {
  white-space: normal;
}
</style>
